package com.itheima.domain;

import java.io.Serializable;
import java.time.LocalDate;

//实现Serializable接口,可以序列化对象
public class Student implements Serializable {
    private String sid;
    private String name;
    private String sex;
    private int age;
    private LocalDate birthday;
    private String phone;
    private int group;

    public Student() {
    }

    public Student(String sid, String name, String sex, LocalDate birthday,String phone) {
        this.sid = sid;
        this.name = name;
        this.sex = sex;
        this.birthday = birthday;//注:生日必须放在年龄前面,否则会空指针
        this.age = getAge();
        this.phone = phone;
        //this.group = getGroup();
    }

    public String getSid() {
        return sid;
    }

    public void setSid(String sid) {
        this.sid = sid;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age = LocalDate.now().getYear() - birthday.getYear();
    }

    public void setAge(int age) {
        this.age = age;
    }

    public LocalDate getBirthday() {
        return birthday;
    }

    public void setBirthday(LocalDate birthday) {
        this.birthday = birthday;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    public int getGroup() {
        return group;
    }

    public void setGroup(int group) {
        this.group = group;
    }
}
